home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / GMS / Source / C / Fading / GreenFade.c next >
Encoding:
C/C++ Source or Header  |  1997-05-04  |  1.4 KB  |  59 lines

  1. /*
  2. ** Fade Demo
  3. ** ---------
  4. ** Fades into a 32 colour picture.  Then fades up to a specified colour
  5. ** (lime green), and then out to black.
  6. **
  7. ** To compile with SAS/C:
  8. **
  9. **    1> sc GreenFade.c link startup=LIB:gms.o data=far
  10. **
  11. */
  12.  
  13. #include <proto/games.h>
  14.  
  15. extern struct GMSBase *GMSBase;
  16. ULONG _XCEXIT = NULL;
  17. ULONG PREFSNAME = DEFAULT;
  18.  
  19. void main(void)
  20. {
  21.    int FState=0;
  22.    struct GameScreen *GameScreen;
  23.    struct Picture *GamePic;
  24.  
  25.    if (GamePic = LoadPicFile("GMS:demos/data/PIC.Loading",VIDEOMEM|GETPALETTE)) {
  26.       if (GameScreen = AddScreenTags(TAGS_GAMESCREEN,NULL,
  27.          GSA_MemPtr1,GamePic->Data,
  28.          GSA_ScrWidth,GamePic->Width,
  29.          GSA_ScrHeight,GamePic->Height,
  30.          GSA_Planes,GamePic->Planes,
  31.          GSA_Palette,GamePic->Palette,
  32.          GSA_ScrMode,GamePic->ScrMode,
  33.          GSA_ScrType,GamePic->ScrType,
  34.          TAGEND)) {
  35.  
  36.          ShowScreen(GameScreen);
  37.  
  38.          do {
  39.            WaitVBL();
  40.            FState = ColourToPalette(GameScreen,FState,2,0,32,GamePic->Palette,0x000000);
  41.          } while (FState != NULL);
  42.  
  43.          do {
  44.            WaitVBL();
  45.            FState = PaletteToColour(GameScreen,FState,2,0,32,GamePic->Palette,0xa5f343);
  46.          } while (FState != NULL);
  47.  
  48.          do {
  49.            WaitVBL();
  50.            FState = ColourMorph(GameScreen,FState,2,0,32,0xa5f343,0x000000);
  51.          } while (FState != NULL);
  52.  
  53.       DeleteScreen(GameScreen);
  54.       }
  55.    FreePic(GamePic);
  56.    }
  57. }
  58.  
  59.